// 废水治理设施点检相关 API 封装
// 参考小程序 pages/form-manager/facility-check/water/index.js 逻辑
import { get, post } from './index'

// 获取废水点检详情
export const getWaterDetail = (id) => get(`/api/form/bizFacilityCheckWate/get/${id}`)

// 获取排扣(排放口)列表 (废水类别字典: ZQT_FSPKLX)
export const getOutletsWater = (pollutionSourceId, outletCategory) => {
	return post(`/api/bizPollutionSourceInfo/outlet/${pollutionSourceId}`, { outletCategory })
}

// 最近一次日均监测数据 (与气不同 monitoringType=01)
export const getLastDayMonitorDataWater = (outletCode, factorCodes = []) => {
	return post(`/api/form/thirdPartMonitor/lastDayMonitorData`, {
		monitoringType: '01',
		outletNo: outletCode,
		igCodes: factorCodes,
	})
}

// 最近一次实时监测数据（用于“出水浓度”）
export const getLastRealMonitorDataWater = (outletCode, factorCodes = []) => {
	return post(`/api/form/thirdPartMonitor/lastRealMonitorData`, {
		monitoringType: '01',
		outletNo: outletCode,
		igCodes: factorCodes,
	})
}

// 获取最近10天内上报记录
export const getNearDataWater = (beginTime, pollutionSourceId) => {
	return post(`/api/form/bizFacilityCheckWate/getNearData`, {
		beginTime,
		pollutionSourceId,
	})
}

// 新增废水点检记录
export const addWaterCheck = (formData) => post(`/api/form/bizFacilityCheckWate/add`, formData)

export default {
	getWaterDetail,
	getOutletsWater,
	getLastDayMonitorDataWater,
	getLastRealMonitorDataWater,
	getNearDataWater,
	addWaterCheck,
}
